/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.evote.monitoreo.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Mendoza
 */
@Entity
@Table(name = "centrovotacion", catalog = "evote", schema = "")
@NamedQueries({
    @NamedQuery(name = "Centrovotacion.findAll", query = "SELECT c FROM Centrovotacion c"),
    @NamedQuery(name = "Centrovotacion.findByIdCentroVotacion", query = "SELECT c FROM Centrovotacion c WHERE c.idCentroVotacion = :idCentroVotacion"),
    @NamedQuery(name = "Centrovotacion.findByNombre", query = "SELECT c FROM Centrovotacion c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Centrovotacion.findByHoraApertura", query = "SELECT c FROM Centrovotacion c WHERE c.horaApertura = :horaApertura"),
    @NamedQuery(name = "Centrovotacion.findByHoraCierre", query = "SELECT c FROM Centrovotacion c WHERE c.horaCierre = :horaCierre")})
public class Centrovotacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idCentroVotacion", nullable = false)
    private Integer idCentroVotacion;
    @Column(name = "nombre", length = 45)
    private String nombre;
    @Column(name = "horaApertura")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaApertura;
    @Column(name = "horaCierre")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaCierre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "centroVotacionidCentroVotacion")
    private List<Locacion> locacionList;
    @JoinColumn(name = "Distrito_idDistrito", referencedColumnName = "idDistrito", nullable = false)
    @ManyToOne(optional = false)
    private Distrito distritoidDistrito;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "centroVotacionidCentroVotacion")
    private List<Operador> operadorList;

    public Centrovotacion() {
    }

    public Centrovotacion(Integer idCentroVotacion) {
        this.idCentroVotacion = idCentroVotacion;
    }

    public Integer getIdCentroVotacion() {
        return idCentroVotacion;
    }

    public void setIdCentroVotacion(Integer idCentroVotacion) {
        this.idCentroVotacion = idCentroVotacion;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Date getHoraApertura() {
        return horaApertura;
    }

    public void setHoraApertura(Date horaApertura) {
        this.horaApertura = horaApertura;
    }

    public Date getHoraCierre() {
        return horaCierre;
    }

    public void setHoraCierre(Date horaCierre) {
        this.horaCierre = horaCierre;
    }

    public List<Locacion> getLocacionList() {
        return locacionList;
    }

    public void setLocacionList(List<Locacion> locacionList) {
        this.locacionList = locacionList;
    }

    public Distrito getDistritoidDistrito() {
        return distritoidDistrito;
    }

    public void setDistritoidDistrito(Distrito distritoidDistrito) {
        this.distritoidDistrito = distritoidDistrito;
    }

    public List<Operador> getOperadorList() {
        return operadorList;
    }

    public void setOperadorList(List<Operador> operadorList) {
        this.operadorList = operadorList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCentroVotacion != null ? idCentroVotacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Centrovotacion)) {
            return false;
        }
        Centrovotacion other = (Centrovotacion) object;
        if ((this.idCentroVotacion == null && other.idCentroVotacion != null) || (this.idCentroVotacion != null && !this.idCentroVotacion.equals(other.idCentroVotacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evote.monitoreo.entity.Centrovotacion[idCentroVotacion=" + idCentroVotacion + "]";
    }

}
